package com.t01.bdqn.servlet;


import com.t01.bdqn.common.ApiResult;
import com.t01.bdqn.entity.ComputerRoom;
import com.t01.bdqn.entity.dto.ComputerRoomQuery;
import com.t01.bdqn.entity.dto.LayuiPage;
import com.t01.bdqn.service.ComputerRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.sql.SQLException;

//  @RestController  ==  @Controller   + @ResponseBody
@RestController
public class ComputerRoomController {

    @Autowired
    ComputerRoomService computerRoomService;

    @RequestMapping(value = "/getComputerRoomList")
    public ApiResult getComputerRoomList(ComputerRoomQuery computerRoomQuery) throws SQLException, IOException, ClassNotFoundException {
        LayuiPage<ComputerRoom> layuiPage = new LayuiPage();
        layuiPage.setCode(0);
        layuiPage.setMsg("查询成功");
        layuiPage.setData(computerRoomService.ComputerSet(computerRoomQuery));
        layuiPage.setCount(computerRoomService.ComputerSetCount(computerRoomQuery));
        if(true)throw new RuntimeException("自建的异常");

        return new ApiResult(200,"查询成功",layuiPage);
    }



}
